﻿using System;
using System.Linq.Expressions;

namespace Cnm.Core.Ultities
{
    public static class ModelExtension
    {
        public static string GetPropertyName<T, TPropType>(this T entity, Expression<Func<T, TPropType>> keySelector)
        {
            var memberExpression = (MemberExpression)keySelector.Body;
            return memberExpression.Member.Name;
        }
    }
}
